#include <bits/stdc++.h>
using namespace std;

#define ONLINE_JUDGE

#ifndef ONLINE_JUDGE
#define dbg(x...) { cerr << "\033[32;1m" << #x << " -> "; err(x); }
void err() { cerr << "\033[39;0m" << endl; }
template<typename T, typename... A>
void err(T a, A... x) { cerr << a << ' '; err(x...); }
#else
#define dbg(...)
#endif

typedef long long LL;

const int N = 400 + 50;

int dp[N][N];

char s[N], t[N];

int n, m, nxt[N][26], last[26];
bool check(int now)
{
	dbg(now);
	for (int i=0; i<=now; ++i)
	{
		for (int j=0; j<=m+20; ++j)
			dp[i][j] = n+1;
	}
	// dbg("FUCK");

	dp[0][now] = 0;
	for (int i=0; i<=now; ++i)
		for (int j=now; j<=m; ++j)
		{
			if (i == 0 && j == now) continue;
			dp[i][j] = n+1;
			int p;
			if (i)
			{
				p = nxt[dp[i-1][j]+1][t[i]-'a'];
				dbg(i, j, dp[i-1][j], p);
				if (~p && dp[i-1][j] <= n)
					dp[i][j] = min(dp[i][j], p);	
			}
			p = nxt[dp[i][j-1]+1][t[j]-'a'];
			dbg(i, j, dp[i][j-1], p);
			if (~p && dp[i][j-1] <= n)
				dp[i][j] = min(dp[i][j], p);
		}
	return dp[now][m] <= n;
}

int main(int argc, char const *argv[])
{
	int tt;
	scanf("%d", &tt);
	while (tt--)
	{
		scanf("%s%s", s+1, t+1);
		n = strlen(s+1); m = strlen(t+1);
		memset(last, 0, sizeof last);
		for (int i=0; i<=n+20; ++i)
			memset(nxt[i], -1, sizeof nxt[i]);
		for (int i=1; i<=n; ++i)
		{
			for (int j=last[s[i]-'a']+1; j<=i; ++j)
				nxt[j][s[i]-'a'] = i;
			last[s[i]-'a'] = i;
		}
		for (int i=3; i<6; ++i)
			for (int j=1; j<=n; ++j)
				dbg(i, j, nxt[j][i]);

		n = strlen(s+1); m = strlen(t+1);
		bool suc = 0;
		for (int i=0; i<m && !suc; ++i)
		{
			suc |= check(i);
		}
		if (suc)
			puts("YES");
		else
			puts("NO");
	}
	
	return 0;
}